<{include file=$module.'/header.html'}>
<div class="page goods-add" id="page-goods-post">
	<header class="bar bar-nav common-bar-nav">
		<a class="pull-left back"><i class="fa fa-arrow-left"></i></a>
		<h1 class="title"><{$act_name}></h1>
	</header>
	<{include file=$module.'/nav.html'}>
	<div class="btn-submit">
		<a href="javascript:;" class="button button-big button-fill button-danger submit-com">提交</a>
	</div>
	<div class="content">
		<form id="form" >
		<input type="hidden" name="id" value="<{$info.id}>" />
		<input type="hidden" name="do" value="<{$action}>" />
		<input type="hidden" name="data[order_status]" value="<{$order_status}>" />
		<{if $info.photos}>
		<div class="content-block-title">图片</div>
		<div class="image-container muti-upload">
			<ul class="upload-list p-b-0">
				<{foreach $info.photos as $val}>
				<li><img src="<{$setting.oss.oss_domain}><{$val}>"></li>
				<{/foreach}>
			</ul>
		</div>
		<{/if}>
		<div class="content-block-title">订单信息</div>
		<div class="list-block">
			<ul>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">标题</div>
							<div class="item-input"><{$info.title}></div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">分类</div>
							<div class="item-input"><{$area.name}> - <{$cate.name}></div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">位置</div>
							<div class="item-input"><{$zone.name}> - <{$info.local}></div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">报修人</div>
							<div class="item-input"><{$admin.realname}> - <{$admin.tel}></div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">师傅</div>
							<div class="item-input"><{$shifu.realname}> - <{$shifu.tel}></div>
						</div>
					</div>
				</li>
			</ul>
		</div>
		
		<{if $order_status==5}>
		<div class="list-block">
			<ul>
				<li class="align-top">
					<div class="item-content">
						<div class="item-inner">
							<div class="item-input">
								<textarea name="data[money_info]" placeholder="请输入材料明细"></textarea>
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">材料费用</div>
							<div class="item-input">
								<input type="text" name="data[money_wx]" value="" placeholder="请输入维修费用">
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">人工费用</div>
							<div class="item-input">
								<input type="text" name="data[money_rg]" value="" placeholder="请输入人工费用">
							</div>
						</div>
					</div>
				</li>
				<!-- <li>
					<div class="item-content">
						<div class="item-inner">
							<div class="item-title label">费用合计</div>
							<div class="item-input">
								<input type="text" id="data-realname" name="rg_money" value="" placeholder="请输入总费用">
							</div>
						</div>
					</div>
				</li> -->
			</ul>
		</div>
		<{/if}>

		<div class="content-block-title">备注</div>
		<div class="list-block m-b-0 other-info">
			<ul>
				<li class="align-top">
					<div class="item-content">
						<div class="item-inner">
							<div class="item-input">
								<textarea name="data[intro]" placeholder="请输入操作备注"></textarea>
							</div>
						</div>
					</div>
				</li>
			</ul>
		</div>

		<div class="content-block-title">图片</div>
		<div class="image-container muti-upload">
			<ul id="upload-list" class="upload-list p-b-1">
				<li class="list-button"><input id="upload-select" type="file" capture="camera" /><i class="fa fa-plus"></i></li>
			</ul>
		</div>

		</form>
		<div class="ui-footspace"></div>
	</div>
</div>


<script src="/static/app/js/qcing.js"></script>
<script src="/static/app/js/upload.js"></script>
<script>
$(function(){

	$(document).on('click', '.submit-com', function(){
		var $this = $(this);
		var order_id = $this.data('id');
		if($this.hasClass('disabled')) {
			return false;
		}
		
		var params = $('#form').serializeArray();
		$this.addClass('disabled');
		$.post("/<{$routeUrl}>/<{$action}>", params, function(response){
			if(response.code == 0){
				$this.removeClass('disabled');
				$.toast(response.msg);
				return false;
			}
			if(response.code == 1){
				$.toast(response.msg, response.url);
			}
		});
	})


	<{if $info.photos}>
	/*=== 默认为 standalone ===*/
	var myPhotoBrowserStandalone = $.photoBrowser({
	  photos : [
	  		<{foreach $info.photos as $val}>
	  		'<{$setting.oss.oss_domain}><{$info.photo}>',
	  		<{/foreach}>
	  ]
	});
	<{/if}>

	//图片预览
	$(document).on('click','.image-container img', function(e){ 
		myPhotoBrowserStandalone.open();
	});

	//上传图片
	$(document).on('change', '#upload-select', function(e){ 
		lhj(this.files[0], {
		    width:1000,
		    height:1000,
		    // 压缩成功
		    done: function (results) {
				$.post('/<{$module}>/api/upload', { base64: results.base64 }, function(data){ 
				  if(data != 'error'){
		    			txt = "<li><img src='" + results.base64+"'><a href='javascript:;' class='remove'>删除</a><input type='hidden' name='photo[]' value='"+ data +"'></li>";
		    			$("#upload-list").append(txt);
				  }else{
				  	error("上传失败");
				  }
				});
		    }
		});
	});
	//删除图片
	$(document).on('click', '.remove', function(e){ 
	 	var file = $(this).parent().find("input").val();
		$.post('/<{$module}>/api/remove', { file: file }, function(data){ 
		});
	 	$(this).parent().remove();
	});


	
});

</script>
<{include file=$module.'/footer.html'}>